package com.heiliushu.baseWeb.Exception;

import com.heiliushu.baseWeb.tools.SpringContextHelper;

public abstract class CustomizeException extends RuntimeException {

	private static final long serialVersionUID = -2023966531829489658L;
	
	private String messageKey;
	private String errorMessage;
	
	public abstract byte buildErrorCode();
	
	public CustomizeException(){
		super();
	}
	
	public CustomizeException(String messageKey){
		super(messageKey);
		this.messageKey = messageKey;
		this.errorMessage = SpringContextHelper.getMessage(messageKey);
	}
	
	public CustomizeException(String messageKey, Throwable e){
		super(messageKey,e);		
		this.messageKey = messageKey;
		this.errorMessage = SpringContextHelper.getMessage(messageKey);
	}

	public String getMessageKey() {
		return messageKey;
	}

	public void setMessageKey(String messageKey) {
		this.messageKey = messageKey;
	}

	public String getErrorMessage() {
		return errorMessage;
	}

}
